import { api } from '../../request/index.js'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    // 轮播图片
    swiperList: [],
    // 导航栏
    navigationList: [],
    // 楼层
    floorList: [],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getSwiperList()
    this.getNavigation()
    this.getFloorList()
  },
  // 获取轮播图
  async getSwiperList() {
    const res = await api({
      url: '/home/swiperdata',
    })
    this.setData({
      swiperList: res.message,
    })
  },
  // 获取导航栏
  async getNavigation() {
    const res = await api({
      url: '/home/catitems',
    })
    this.setData({
      navigationList: res.message,
    })
  },
  // 获取楼层数据
  async getFloorList() {
    const res = await api({
      url: '/home/floordata',
    })
    this.setData({
      floorList: res.message,
    })
  },
})
